***********************************************************************************************************************************************
***********************************************************************************************************************************************
*************** Trade Balance and Policy Complexity: Explaining Political Elites' Focus on International Trade at the Domestic Level **********
******************************************************* Heather Elko McKibben and Timothy W. Taylor *******************************************
***************************************************************** analysis run using Stata 16.0 ***********************************************
***********************************************************************************************************************************************
***********************************************************************************************************************************************

******VARIABLE DESCRIPTIONS:
*ccode = Correlates of War country code
*cmp_trade = Comparative Manifesto Project's (Budge, et al. 2001; Volkens, et al. 2017) measure of a party's focus on protectionism positively (protect, CMP code 406) + its focus on protectionism negatively (free, CMP code 407)
*date = election date
*eu = idicator of whether a country was a member of the European Union in a given year
*free = Comparative Manifesto Project's (Budge, et al. 2001; Volkens, et al. 2017) measure of a party's focus on protectionism negatively (CMP code 407)
*ln_wbgdp = the natural log of a country's GDP (measure from World Bank)
*news_trade = measure from Comparative Agendas Project (Dowding, Hindmoor, and Martin 2016) of the amount of coverage in the country’s major newspaper (e.g. London Times) on trade in a given year 
*oecdthen = indicator of whether a country was a member of the OECD in a given year
*oral_trade = measure from Comparative Agendas Project (Dowding, Hindmoor, and Martin 2016) of the amount of oral comments in the national legislature on trade in a given year
*panel_party = time series unit party panel indicator
*party = Comparative Manifesto Project's (Budge, et al. 2001; Volkens, et al. 2017) party code
*partyname = name of party in English
*protect = Comparative Manifesto Project's (Budge, et al. 2001; Volkens, et al. 2017) measure of a party's focus on protectionism positively (CMP, code 406)
*PTA_desta_depth_index_mean = average of depth (as calcuated using the index) coded by the Design of Trade Agreements dataset (Dur, Baccini, and Elsig 2014)
*PTA_desta_depth_rasch_mean = average of depth (as calculated using the rasch technique) coded by the Design of Trade Agreements dataset (Dur, Baccini, and Elsig 2014)
*right = Comparative Manifesto Project's (Budge, et al. 2001; Volkens, et al. 2017) coding of a party's ideology from left to right 
*time1 = time
*time2 = time^2
*time3 = time^3
*trade_deficit_wbgdp = total level of imports minus total level of exports for a country (Correlates of War trade data, version 4.0 (Barbieri, Keshk, and Pollins 2009; Barbieri and Keshk 2016)) divided by GDP (measure from World Bank)
*trade_surplus_wbgdp = total level of exports minus total level of imports for a country (Correlates of War trade data, version 4.0 (Barbieri, Keshk, and Pollins 2009; Barbieri and Keshk 2016)) divided by GDP (measure from World Bank)
*trade_wbgdp = total level of trade for a country (Correlates of War trade data, version 4.0 (Barbieri, Keshk, and Pollins 2009; Barbieri and Keshk 2016)) divided by GDP (measure from World Bank)
*tv_trade = measure from Comparative Agendas Project (Dowding, Hindmoor, and Martin 2016) of the amount of coverage in the country’s major television news on trade in a given year 
*UNcomcomm_trade_deficit_wbgdp = total level of imports minus total level of exports (UN Comtrade measure of trade in commodities, does not include re-exports and re-imports) divided by GDP (measure from World Bank)
*UNcomcomm_trade_surplus_wbgdp = total level of exports minus total level of imports (UN Comtrade measure of trade in commodities, does not include re-exports and re-imports) divided by GDP (measure from World Bank)
*UNcomcomm_trade_wbgdp = total level of trade for a country (UN Comtrade measure of trade in commodities, does not include re-exports and re-imports) divided by GDP (measure from World Bank)
*WTO_trade_deficit_wbgdp = total level of imports minus total level of exports for a country (World Trade Organization measure of trade in goods and services) divided by GDP (measure from World Bank)
*WTO_trade_surplus_wbgdp = total level of exports minus total level of imports for a country (World Trade Organization measure of trade in goods and services) divided by GDP (measure from World Bank)
*WTO_trade_wbgdp = total level of trade for a country (World Trade Organization of trade in goods and services) divided by GDP (measure from World Bank)
*NOTE: keeping variables in order, canada-newzealand captures country fixed effects (omitted category=us); yr1964-yr2010 captures time dummies (omitted category=yr2011); "fe" code captures party fixed effects


use McKibben-Taylor_replication.dta, clear


*xtset the data
sort party year
by party: gen time=_n
xtset party time



*****************CHECK FOR UNIT ROOTS:

xtfisher cmp_trade 
*reject null of unit root

xtfisher free 
*reject null of unit root

xtfisher protect 
*reject null of unit root



****************************************MODELS FOR PAPER & WEB APPENDIX


***********************MAIN MODELS FOR PAPER: MAIN MEASURE OF TRADE (Correlates of War Trade Data, version 4.0) WITH PANEL-CORRECTED STANDARD ERRORS (Models 1-3) AND COUNTRY FIXED EFFECTS (Models 4-6)

***MODEL 1: OVERALL TRADE FOCUS (panel corrected standard errors)

*test for fixed v. random effects
xtreg cmp_trade trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp l.cmp_trade, re
eststo random_effects
xtreg cmp_trade trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp l.cmp_trade, fe
hausman . random_effects
*violates assumption that difference in coefficients is not systematic, so do not use random effects

*test for groupwise heteroskedasticity
xtreg cmp_trade trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp l.cmp_trade, fe
xttest3
*violates fe assumption, so use panel-corrected standard errors (but run Model 4 as an fe model as robustness check)

*final model
xtpcse cmp_trade trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp l.cmp_trade, pairwise
eststo model1



***MODEL 2:  FREE (panel corrected standard errors)

*test for fixed v. random effects
xtreg free trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade l.free, re
eststo random_effects
xtreg free trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade l.free, fe
hausman . random_effects
*violates assumption that difference in coefficients is not systematic, so do not use random effects

*test for groupwise heteroskedasticity
xtreg free trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade l.free, fe
xttest3
*violates fe assumption, so use panel-corrected standard errors (but run Model 5 as an fe model as robustness check)

*final model
xtpcse free trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade l.free, pairwise
eststo model2
*get marginal effects
margins, dydx(trade_surplus_wbgdp) at(PTA_desta_depth_rasch_mean=(0(.01)3))
marginsplot, xtitle(Complexity of Trade Policies) ytitle(Marginal Effects of Increase in Trade Surplus) scheme(s1mono)
graph save Graph "Figure1_for_paper.gph", replace



***MODEL 3: PROTECT (panel corrected standard errors)
*test for fixed v. random effects
xtreg protect trade_wbgdp c.trade_deficit_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade l.protect, re
eststo random_effects
xtreg protect trade_wbgdp c.trade_deficit_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade l.protect, fe
hausman . random_effects
*violates assumption that difference in coefficients is not systematic, so do not use random effects

*test for groupwise heteroskedasticity
xtreg protect trade_wbgdp c.trade_deficit_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade l.protect, fe
xttest3
*violates fe assumption, so use panel-corrected standard errors (but run Model 6 as an fe model as robustness check)

*final model
xtpcse protect trade_wbgdp c.trade_deficit_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade l.protect, pairwise
eststo model3
*get marginal effects
margins, dydx(trade_deficit_wbgdp) at(PTA_desta_depth_rasch_mean=(0(.01)3))
marginsplot, xtitle(Complexity of Trade Policies) ytitle(Marginal Effects of Increase in Trade Deficit) scheme(s1mono)
graph save Graph "Figure2_for_paper.gph", replace


*MODEL 4: OVERALL TRADE FOCUS (COUNTRY FIXED EFFECTS):
xtreg cmp_trade trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp l.cmp_trade canada-newzealand, robust
eststo model4

*MODEL 5: FREE (COUNTRY FIXED EFFECTS):
xtreg free trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade l.free canada-newzealand, robust
eststo model5
*get marginal effects - use ar1 correction in place of lagged DV because can't run margins with the use of a lagged DV
xtregar free trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade canada-newzealand
margins, dydx(trade_surplus_wbgdp) at(PTA_desta_depth_rasch_mean=(0(.01)3))
marginsplot, xtitle(Complexity of Trade Policies) ytitle(Marginal Effects of Increase in Trade Surplus) scheme(s1mono)
graph save Graph "Figure1_for_WA.gph", replace


*MODEL 6: PROTECT (COUNTRY FIXED EFFECTS):
xtreg protect trade_wbgdp c.trade_deficit_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade l.protect canada-newzealand, robust
eststo model6
*get marginal effects - use ar1 correction in place of lagged DV because can't run margins with the use of a lagged DV
xtregar protect trade_wbgdp c.trade_deficit_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade canada-newzealand
margins, dydx(trade_deficit_wbgdp) at(PTA_desta_depth_rasch_mean=(0(.01)3))
marginsplot, xtitle(Complexity of Trade Policies) ytitle(Marginal Effects of Increase in Trade Deficit) scheme(s1mono)
graph save Graph "Figure2_for_WA.gph", replace


esttab model1 model2 model3 model4 model5 model6 using "Table1_for_paper.tex", star(* 0.10 ** 0.05) compress nonumbers label title("Explaining the Way Political Elites Focus on Trade") nonumbers mtitles("Model 1" "Model 2" "Model 3" "Model 4" "Model 5" "Model 6") replace b(2) se(2) r2 scalars("chi2 Chi-squared")



*********************************WEB APPENDIX ROBUSTNESS CHECKS 1 ("A" MODELS): Re-run Models 1-3 in the paper using panel corrected standard errors with time trends

*MODEL 1A: OVERALL TRADE FOCUS (panel corrected standard errors with time trends):
xtpcse cmp_trade trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp time1 time2 time3 l.cmp_trade, pairwise
eststo model1a

*MODEL 2A: FREE (panel corrected standard errors with time trends):
xtpcse free trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade time1 time2 time3 l.free, pairwise
eststo model2a
margins, dydx(trade_surplus_wbgdp) at(PTA_desta_depth_rasch_mean=(0(.01)3))
marginsplot, xtitle(Complexity of Trade Policies) ytitle(Marginal Effects of Increase in Trade Surplus) scheme(s1mono)
graph save Graph "Figure3_for_WA.gph", replace

*MODEL 3A: PROTECT (panel corrected standard errors with time trends):
xtpcse protect trade_wbgdp c.trade_deficit_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade time1 time2 time3 l.protect, pairwise
eststo model3a
margins, dydx(trade_deficit_wbgdp) at(PTA_desta_depth_rasch_mean=(0(.01)3))
marginsplot, xtitle(Complexity of Trade Policies) ytitle(Marginal Effects of Increase in Trade Deficit) scheme(s1mono)
graph save Graph "Figure4_for_WA.gph", replace


esttab model1a model2a model3a using "Table9_for_WA.tex", star(* 0.10 ** 0.05) compress nonumbers label title("Explaining How Political Elites Focus on Trade") nonumbers mtitles("Model 1A" "Model 2A" "Model 3A") replace b(2) se(2) r2 scalars("chi2 Chi-squared")




*********************************ROBUSTNESS CHECKS 2 ("B" MODELS): Re-run Models 1-3 in the paper using  WTO TRADE MEASURE 

*MODEL 1B: OVERALL TRADE FOCUS (WTO TRADE MEASURE):
xtpcse cmp_trade WTO_trade_wbgdp c.WTO_trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp l.cmp_trade , pairwise
eststo model1b


*MODEL 2B: FREE  (WTO TRADE MEASURE):
xtpcse free WTO_trade_wbgdp c.WTO_trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade l.free , pairwise
eststo model2b
margins, dydx(WTO_trade_surplus_wbgdp) at(PTA_desta_depth_rasch_mean=(0(.01)3))
marginsplot, xtitle(Complexity of Trade Policies) ytitle(Marginal Effects of Increase in Trade Surplus) scheme(s1mono)
graph save Graph "Figure5_for_WA.gph", replace


*MODEL 3B: PROTECT  (WTO TRADE MEASURE):
xtpcse protect WTO_trade_wbgdp c.WTO_trade_deficit_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade l.protect , pairwise
eststo model3b
margins, dydx(WTO_trade_deficit_wbgdp) at(PTA_desta_depth_rasch_mean=(0(.01)3))
marginsplot, xtitle(Complexity of Trade Policies) ytitle(Marginal Effects of Increase in Trade Deficit) scheme(s1mono)
graph save Graph "Figure6_for_WA.gph", replace

esttab model1b model2b model3b using "Table10_for_WA.tex", star(* 0.10 ** 0.05) compress nonumbers label title("Explaining How Political Elites Focus on Trade" (WTO trade measure)) nonumbers mtitles("Model 1B" "Model 2B" "Model 3B") replace b(2) se(2) r2 scalars("chi2 Chi-squared")



*********************************ROBUSTNESS CHECKS 3 ("C" MODELS): Re-run Models 1-3 in the paper using UN Comtrade measure (exports and imports of goods - not re-exports and re-imports and not services (services data only goes back to 2000)

*MODEL 1C: OVERALL TRADE FOCUS:
xtpcse cmp_trade UNcomcomm_trade_wbgdp c.UNcomcomm_trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp l.cmp_trade , pairwise
eststo model1c


*MODEL 2C: FREE:
xtpcse free UNcomcomm_trade_wbgdp c.UNcomcomm_trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade l.free , pairwise
eststo model2c
margins, dydx(UNcomcomm_trade_surplus_wbgdp) at(PTA_desta_depth_rasch_mean=(0(.01)3))
marginsplot, xtitle(Complexity of Trade Policies) ytitle(Marginal Effects of Increase in Trade Surplus) scheme(s1mono)
graph save Graph "Figure7_for_WA.gph", replace


*MODEL 3C: PROTECT:
xtpcse protect UNcomcomm_trade_wbgdp c.UNcomcomm_trade_deficit_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade l.protect , pairwise
eststo model3c
margins, dydx(UNcomcomm_trade_deficit_wbgdp) at(PTA_desta_depth_rasch_mean=(0(.01)3))
marginsplot, xtitle(Complexity of Trade Policies) ytitle(Marginal Effects of Increase in Trade Deficit) scheme(s1mono)
graph save Graph "Figure8_for_WA.gph", replace


esttab model1c model2c model3c using "Table11_for_WA.tex", star(* 0.10 ** 0.05) compress nonumbers label title("Explaining How Political Elites Focus on Trade" (UNComtrade trade measure)) nonumbers mtitles("Model 1C" "Model 2C" "Model 3C") replace b(2) se(2) r2 scalars("chi2 Chi-squared")



*********************************ROBUSTNESS CHECKS 4 ("D" MODELS): Re-run Models 1-3 in the paper using alternative complexity measure (DESTA index mean) 


*MODEL 1D: OVERALL TRADE FOCUS (alternative complexity measure and panel-corrected standard errors):
xtpcse cmp_trade trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_index_mean right eu ln_wbgdp l.cmp_trade, pairwise
eststo model1d


*MODEL 2D: FREE (alternative complexity measure and panel-corrected standard errors):
xtpcse free trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_index_mean right eu ln_wbgdp cmp_trade l.free, pairwise
eststo model2d
margins, dydx(trade_surplus_wbgdp) at(PTA_desta_depth_index_mean=(0(.02)6))
marginsplot, xtitle(Complexity of Trade Policies) ytitle(Marginal Effects of Increase in Trade Surplus) scheme(s1mono)
graph save Graph "Figure9_for_WA.gph", replace

*MODEL 3D: PROTECT (alternative complexity measure and panel-corrected standard errors):
xtpcse protect trade_wbgdp c.trade_deficit_wbgdp##c.PTA_desta_depth_index_mean right eu ln_wbgdp cmp_trade l.protect, pairwise
eststo model3d
margins, dydx(trade_deficit_wbgdp) at(PTA_desta_depth_index_mean=(0(.02)6))
marginsplot, xtitle(Complexity of Trade Policies) ytitle(Marginal Effects of Increase in Trade Deficit) scheme(s1mono)
graph save Graph "Figure10_for_WA.gph", replace


esttab model1d model2d model3d using "Table12_for_WA.tex", star(* 0.10 ** 0.05) compress nonumbers label title("Explaining How Political Elites Focus on Trade" (alternative complexity measure)) nonumbers mtitles("Model 1D" "Model 2D" "Model 3D") replace b(2) se(2) r2 scalars("chi2 Chi-squared")



*************************************ROBUSTNESS CHECKS 5("E" MODELS): Re-run Models 1-3 in the paper using country and year fixed effects


*MODEL 1E: OVERALL TRADE FOCUS (COUNTRY FIXED EFFECTS + YEAR DUMMIES):
xtreg cmp_trade trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp l.cmp_trade yr1964-yr2010 canada-newzealand, robust
eststo model1e

*MODEL 2E: FREE (COUNTRY FIXED EFFECTS + YEAR DUMMIES):
xtreg free trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade l.free yr1964-yr2010 canada-newzealand, robust
eststo model2e
*get marginal effects - use ar1 correction in place of lagged DV because can't run margins with the use of a lagged DV
xtregar free trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade yr1964-yr2010 canada-newzealand
margins, dydx(trade_surplus_wbgdp) at(PTA_desta_depth_rasch_mean=(0(.01)3))
marginsplot, xtitle(Complexity of Trade Policies) ytitle(Marginal Effects of Increase in Trade Surplus) scheme(s1mono)
graph save Graph "Figure11_for_WA.gph", replace

*MODEL 3E: PROTECT (COUNTRY FIXED EFFECTS + YEAR DUMMIES):
xtreg protect trade_wbgdp c.trade_deficit_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade l.protect yr1964-yr2010  canada-newzealand, robust
eststo model3e
*get marginal effects - use ar1 correction in place of lagged DV because can't run margins with the use of a lagged DV
xtregar protect trade_wbgdp c.trade_deficit_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade yr1964-yr2010 canada-newzealand
margins, dydx(trade_deficit_wbgdp) at(PTA_desta_depth_rasch_mean=(0(.01)3))
marginsplot, xtitle(Complexity of Trade Policies) ytitle(Marginal Effects of Increase in Trade Deficit) scheme(s1mono)
graph save Graph "Figure12_for_WA.gph", replace


esttab model1e model2e model3e using "Table13_for_WA.tex", star(* 0.10 ** 0.05) compress nonumbers label title("Explaining How Political Elites Focus on Trade" (with country and year fixed effects)) nonumbers mtitles("Model 1E" "Model 2E" "Model 3E") replace b(2) se(2) r2 scalars("chi2 Chi-squared")



*************************************ROBUSTNESS CHECKS 6 ("F" MODELS): Re-run Models 1-3 in the paper using party fixed effects


*MODEL 1F: OVERALL TRADE FOCUS (PARTY FIXED EFFECTS):
xtreg cmp_trade trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp l.cmp_trade, fe robust
eststo model1f


*MODEL 2F: FREE (PARTY FIXED EFFECTS):
xtreg free trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade l.free, fe robust
eststo model2f
*get marginal effects - use ar1 correction in place of lagged DV because can't run margins with the use of a lagged DV
xtregar free trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade, fe
margins, dydx(trade_surplus_wbgdp) at(PTA_desta_depth_rasch_mean=(0(.01)3))
marginsplot, xtitle(Complexity of Trade Policies) ytitle(Marginal Effects of Increase in Trade Surplus) scheme(s1mono) level(90)
graph save Graph "Figure13_for_WA.gph", replace


*MODEL 3F: PROTECT (PARTY FIXED EFFECTS):
xtreg protect trade_wbgdp c.trade_deficit_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade l.protect, fe robust
eststo model3f
*get marginal effects - use ar1 correction in place of lagged DV because can't run margins with the use of a lagged DV
xtregar protect trade_wbgdp c.trade_deficit_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp cmp_trade, fe
margins, dydx(trade_deficit_wbgdp) at(PTA_desta_depth_rasch_mean=(0(.01)3))
marginsplot, xtitle(Complexity of Trade Policies) ytitle(Marginal Effects of Increase in Trade Deficit) scheme(s1mono) level(90)
graph save Graph "Figure14_for_WA.gph", replace


esttab model1f model2f model3f using "Table14_for_WA.tex", star(* 0.10 ** 0.05) compress nonumbers label title("Explaining How Political Elites Focus on Trade" (with party fixed effects)) nonumbers mtitles("Model 1F" "Model 2F" "Model 3F") replace b(2) se(2) r2 scalars("chi2 Chi-squared")







***************************************Comparative Policies Agenda models as robustness check on Election Manifesto findings

*MODEL 1G: ORAL_TRADE (the amount of oral comments in the national legislature on trade in a given year):
xtpcse oral_trade trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp l.oral_trade , pairwise 
eststo model1g

*MODEL 1H: NEWS_TRADE (the amount of coverage in the country’s major newspaper (e.g. London Times) on trade in a given year):
xtpcse news_trade trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp l.news_trade , pairwise 
eststo model1h

*MODEL 1I: TV_TRADE (the amount of coverage in the country’s major television news on trade in a given year):
xtpcse tv_trade trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean right eu ln_wbgdp l.tv_trade , pairwise 
eststo model1i


esttab model1g model1h model1i using "Table15_for_WA.tex", star(* 0.10 ** 0.05) compress nonumbers label title("Explaining How Political Elites Focus on Trade (Comparative Policies Agenda measures analyzing focus on trade)") nonumbers mtitles("Model 1G" "Model 1H" "Model 1I") replace b(2) se(2) r2 scalars("chi2 Chi-squared")





******************************Check interaction between "right" and "level of development" - analyzing free trade and protectionist focus of different types of parties in developed and developing countries


*MODEL 2J: FREE:
xtpcse free trade_wbgdp c.trade_surplus_wbgdp##c.PTA_desta_depth_rasch_mean ln_wbgdp eu oecdthen##c.right cmp_trade l.free , pairwise 
eststo model2j
*get marginal effects
margins, dydx(right) at(oecdthen=(0 1))
marginsplot, xtitle(OECD status) ytitle(Marginal Effects of Increase in Right-leaning Party Ideology) scheme(s1mono)
graph save Graph "Figure15_for_WA.gph", replace

*MODEL 3J: PROTECT:
xtpcse protect trade_wbgdp c.trade_deficit_wbgdp##c.PTA_desta_depth_rasch_mean ln_wbgdp eu  oecdthen##c.right cmp_trade l.protect , pairwise 
eststo model3j
*get marginal effects
margins, dydx(right) at(oecdthen=(0 1))
marginsplot, xtitle(OECD status) ytitle(Marginal Effects of Increase in Right-leaning Party Ideology) scheme(s1mono)
graph save Graph "Figure16_for_WA.gph", replace


esttab model2j model3j using "Table16_for_WA.tex", star(* 0.10 ** 0.05) compress nonumbers label title("Explaining How Political Elites Focus on Trade") nonumbers mtitles("Model 2J" "Model 3J") replace b(2) se(2) r2 scalars("chi2 Chi-squared")


